@echo off
:: 启用延迟变量扩展
setlocal enabledelayedexpansion

:: 启动 JAR 文件，并传入参数 start
java -jar demo1-1.0-SNAPSHOT.jar start

:: 获取当前 Java 进程的 PID，并去除引号
for /f "tokens=2 delims=," %%i in ('tasklist /fi "imagename eq java.exe" /fo csv /nh') do (
    set pid=%%~i
    echo !pid! > pid.txt
)

:: 输出 PID 已写入文件
echo PID has been written to pid.txt

endlocal
